<template>
	<!-- 收获地址 -->
	<view class="address">
		<view class="ades public_sty">
			<view class="ades_box" v-for="(item, index) in addressList" :key="index">
				<view class="ades_left">
					<view class="ades_address">
						<uni-tag v-show="item.defult" text="默认" type="success" size="11"></uni-tag>
						<text>{{ item.address }}</text>
					</view>
					<view class="deils_address">
						<text>{{ item.detailress }}</text>
					</view>
					<view class="ades_address">
						<text style="margin-right: 20rpx;">{{ item.name }}</text>
						<text>{{ item.phone }}</text>
					</view>
				</view>
				<view class="" style="line-height: 70px;"><uni-icons type="compose" @click="modify(item)"></uni-icons></view>
			</view>
		</view>
		<button class="btn" type="primary" @click="addressBtn">
			<text style="font-size: 32rpx; margin-right: 10rpx;">+</text>
			<text>新增收货地址</text>
		</button>
	</view>
</template>

<script>
export default{
	data(){
		return{
			addressList:[
				{
					name:"张三",
					address:'上海市  浦东新区  陆家嘴街道',
					detailress:'金砖大厦12楼',
					phone:'17602334923',
					defult:true,
				},
				{
					name:"张三",
					address:'上海市  浦东新区  陆家嘴街道',
					detailress:'花园石桥路28弄21栋201',
					phone:'17602334923',
					defult:false,
				},
				{
					name:"张三",
					address:'上海市  浦东新区  陆家嘴街道',
					detailress:'东亚银行金融大厦',
					phone:'17602334923',
					defult:false,
				},
				{
					name:"张三",
					address:'上海市  浦东新区  陆家嘴街道',
					detailress:'银城中路501号上海中心大厦',
					phone:'17602334923',
					defult:false,
				},
				{
					name:"张三",
					address:'上海市  浦东新区  陆家嘴街道',
					detailress:'太平金融大厦12楼',
					phone:'17602334923',
					defult:false,
				},
			]
		}
	},
	methods:{
		addressBtn(){
			if(this.addressList.length==10){
				uni.showToast({
					title:'已达到10条上限，请先删除不常用地址',
					icon:'none'
				})
			}else{
				// console.log("未达到10条")
				let data = {}
				uni.navigateTo({
					url:'../address/addormodify?type=0&item='+ JSON.stringify(data),

				})
			}
		},
		modify(item){
			let data =item

			uni.navigateTo({
				url:'/pages/address/addormodify?type=1&item='+ JSON.stringify(data)
			})
		}
	}
}
</script>

<style lang="scss" scoped>
.address {
	height: 100vh;
	background-color: #f9faf9 100%;
	padding: 30rpx;
}
.ades {
	padding: 30rpx;
	.ades_box {
		display: flex;
		// align-items: center;
		justify-content: space-between;
	}
	.ades_left {
		padding-bottom: 56rpx;
		.ades_address {
			font-size: 28rpx;
			color: #999999;
			/deep/ .uni-tag {
				padding: 0rpx 10rpx;
				line-height: 28rpx;
				font-size: 22rpx;
			}
		}
		.deils_address {
			color: #333333;
			font-weight: 550;
			margin: 5px 0px;
		}
	}
}
.btn {
	position: fixed;
	bottom: 2%;
	left: 4%;
	width: 92%;
	border-radius: 20rpx;
	text {
		font-size: 14px;
	}
}
</style>
